/*
 * LockedNumber.h
 *
 *  Created on:  Jun 12, 2009
 *      Author:  Zach Riggle A37627537
 *      Project: CSE410 Project 2
 */

#ifndef LOCKEDNUMBER_H_
#define LOCKEDNUMBER_H_

#include <pthread.h>

class LockedNumber {
public:
    LockedNumber();
    virtual ~LockedNumber();

    int tryLock();
    int unlock();

    void set(int);
    int get();
private:
    int lockCount;
    int semCount;

// Mutliprocess/thread safety with pthread mutexes...
    pthread_mutexattr_t *lockAttr;
    pthread_mutex_t *lock;

//	sem_t sem;

// Shared memory information
    volatile int *  data;
};

#endif /* LOCKEDNUMBER_H_ */
